<?php 

@session_start();

?>

<?php
$select = $_POST['select'];
$_SESSION['sel'] = $select; 
$allowedExt = array("csv");

foreach ($_FILES as $file){
  
if ($file['tmp_name'] > ''){
	
if (!in_array(end(explode(".",strtolower($file['name']))),$allowedExt)){
$msg = $file['name']." is an invalid file type!";
header("location:insertMultiple.php?poll=$msg");
 }else{
$uploadFile = @$_POST['uploadFile']; 
$target_path = "uploads/";
$target_path = ($target_path . basename( $_FILES['uploadFile']['name']));

if(move_uploaded_file($_FILES['uploadFile']['tmp_name'], $target_path)) {
include('insertData.php');
 }

else{
$msg = "File Upload Failed!!, Please try again";
header("location:insertMultiple.php?poll=$msg");
  }

}
   }else{
   
$msg = "Please select a file to upload";
header("location:insertMultiple.php?poll=$msg");
   }
}
?>